package com.ruoyi.inspection.config;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class GovernDataConfig {
    static {
        JIAN_CHA_LEI_XING = collectToMap(1,"企业自查","市级及以下检查","省级检查","部级检查");
        YIN_HUAN_LAI_YUAN = collectToMap(1,"日常排查","综合性排查","专业性排查",
                                        "季节性排查","重点时段及节假日前排查","事故类比排查",
                                        "复产复工前排查","外聘专家诊断式排查","管控措施实效","其他");
        YIN_HUAN_LEI_XING = collectToMap(1,"安全","工艺","电气","仪表","消防","总图","设备","其他","操作");
        WEI_HAI_LEI_XING = collectToMap(1,"事故隐患","火灾隐患");
        ZHI_LI_LEI_XING = collectToMap(0,"即查即改","限期整改");
        YIN_HUAN_LEI_BIE = collectToMap(0,"其他隐患","主要负责人登记隐患","技术负责人登记隐患","操作负责人登记隐患");
        YIN_HUAN_DENG_JI = collectToMap(0,"一般隐患","重大隐患");
        YIN_HUAN_ZHUANG_TAI = collectToMap(0,"待整改","待复核","延期整改","已超时","9:已完成");
        PAI_CHA_JI_BIE = collectToMap(0,"公司级","车间级","班组级");
    }


    // 检查类型
    public static final Map<String, Integer> JIAN_CHA_LEI_XING;
    // 隐患来源
    public static final Map<String, Integer> YIN_HUAN_LAI_YUAN;
    // 隐患类型
    public static final Map<String, Integer> YIN_HUAN_LEI_XING;
    // 隐患治理类型
    public static final Map<String, Integer> ZHI_LI_LEI_XING;
    // 危害类型
    public static final Map<String, Integer> WEI_HAI_LEI_XING;
    // 隐患类别 默认：0其他隐患
    public static final Map<String, Integer> YIN_HUAN_LEI_BIE;
    // 隐患等级
    public static final Map<String, Integer> YIN_HUAN_DENG_JI;
    // 隐患状态
    public static final Map<String, Integer> YIN_HUAN_ZHUANG_TAI;
    // 排查级别
    public static final Map<String, Integer> PAI_CHA_JI_BIE;

    private static Map<String, Integer> collectToMap(int interval, String ...stringArray) {
        return IntStream.range(0, stringArray.length)
                .boxed()
                .collect(Collectors.toMap(i -> stringArray[i].contains(":") ? stringArray[i].split(":")[1] : stringArray[i], i -> stringArray[i].contains(":") ? Integer.parseInt(stringArray[i].split(":")[0]) : i+interval));
    }

    public static List<String> getList(Map<String, Integer> map) {
        return map.keySet().stream().collect(Collectors.toList());
    }

}
